class Solution {
public:
    int massage(vector<int>& nums) {
        int m = nums.size();
        if (m == 0)
            return 0;
        if (m == 2)
            return max(nums[0], nums[1]);
        else if (m == 1)
            return nums[0];

        vector<int> dp(m);
        dp[0] = nums[0];
        dp[1] = nums[1];

        for (int i = 2; i < m; ++i)
        {
            dp[i] = max(dp[i - 1], dp[i - 2] + nums[i]);
        }
        return dp[m - 1];
    }
};